const mysql = require('mysql')
const pool = mysql.createPool({
    host:"127.0.0.1",
    limit:100,
    user:'root',
    password:'root',
    database:'project'
});

function query(sql,callback) {
    pool.getConnection((err,connection)=>{
        if (err){
            throw err;
        }else {
            connection.query(sql,(err,result)=>{
                callback(err,result);
                connection.release();
            })
        }
    })
}

module.exports = query;